#include<iostream>
#include<algorithm>
#include<iomanip>
using namespace std;
const int N = 1e6 + 10;
struct node
{
	int val;
	int id;
}s[N];
int n;
int cmp(node a, node b)
{
	return a.val < b.val;
}
int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> s[i].val;
		s[i].id = i;
	}
	sort(s + 1, s + n + 1, cmp);
	long long sum = 0;
	for (int i = 1; i <= n; i++) {
		sum += (long long)(n - i) * s[i].val;
	}
	for (int i = 1; i <= n; i++) {
		cout << s[i].id << " ";
	}
	cout << endl;
	cout << fixed << setprecision(2) << sum * 1.0 / n << endl;
	return 0;
}